<template>
  <div class="bg-tabs-1">
    <div class="bg-tabs-item" @click="change(item)" v-for="item in tabs">
      <div class="bg-tabs-item-icon" v-if="item.value === value"></div>
      <span :class="item.value === value ? 'active' : 'noactive'">
        {{ item.name }}
      </span>
    </div>
    <!-- <div class="bg-tabs-item">
            <span class="noactive">
                科技创新
            </span>
        </div> -->
  </div>
</template>
<script>
export default {
  props: {
    tabs: {
      type: Array,
      default: function () {
        return [
          {
            name: '增值保供',
            value: '1',
          },
          {
            name: '科技创新',
            value: '2',
          },
        ]
      },
    },
    value: {
      type: String,
      default: '',
    },
    isCancel: {
      type: Boolean,
      default: true,
    },
  },
  model: {
    prop: 'value',
    event: 'change',
  },
  data() {
    return {
      // value:''
    }
  },
  methods: {
    change(item) {
      if (this.tabs.length === 1) return
      if (item.value === this.value && this.isCancel === true) {
        this.$emit('change', '')
      } else {
        this.$emit('change', item.value)
      }

      // this.$emit('change', this.value)
    },
  },
}
</script>
<style lang="scss">
.bg-tabs-1 {
  display: flex;
  align-items: center;
  gap: 24px;
  .bg-tabs-item {
    display: flex;
    align-items: center;
    gap: 12px;
    .bg-tabs-item-icon {
      width: 4px;
      height: 15px;

      /* 图表3 */
      background: linear-gradient(0deg, #1fe79a 0%, #a6ffdd 100%);

      margin: 0px -1px;
      z-index: 1;
    }
    span.active {
      opacity: 1;
      font-family: YouSheBiaoTiHei;
      font-size: 18px;
      font-weight: normal;
      line-height: 18px;
      letter-spacing: 0em;

      font-variation-settings: 'opsz' auto;
      background: linear-gradient(180deg, #d5fff5 15%, #8cd9c5 84%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      text-fill-color: transparent;
      z-index: 0;
      cursor: pointer;
    }
    span.noactive {
      opacity: 1;
      cursor: pointer;
      font-family: YouSheBiaoTiHei;
      font-size: 18px;
      font-weight: normal;
      line-height: 18px;
      letter-spacing: 0em;

      font-variation-settings: 'opsz' auto;
      color: #ffffff;

      z-index: 0;
    }
  }
}
</style>
